package com.acando.mate.view;

import com.acando.mate.NewsAdapter;
import com.acando.mate.R;

import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

public class StatusFragment extends Fragment{

	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		
		// Retrieving the currently selected item number
		
		// Creating view corresponding to the fragment
		View v = inflater.inflate(R.layout.news_fragment, container, false);

		// Updating the action bar title
		getActivity().getActionBar().setTitle("AcandoMate");
		
		//Initializing and loading url in webview
		ListView listView = (ListView)v.findViewById(R.id.newsListView); 
		NewsAdapter newsAdapter = new NewsAdapter(getActivity(), new String[] { "1","2","3","4","5" });
		listView.setAdapter(newsAdapter);
		listView.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				getActivity().startActivity(new Intent(getActivity(), StatusFormActivity.class));
			}
		});
        
		return v;
	}
	
}
